package com.gmail.dengtao.joe.group.channel;

import com.gmail.dengtao.joe.group.channel.Channel;
import com.gmail.dengtao.joe.group.channel.ChannelListener;
import com.gmail.dengtao.joe.group.member.Member;

public class MyChannelListener implements ChannelListener {

	//private static Logger LOGGER = LoggerFactory.getLogger(MyChannelListener.class);

	@Override
	public void dataReceived(Channel channel, Member sender, Object data) throws Exception {
		System.out.println("R:" + new String((byte[])data));
	}

	@Override
	public void dataSent(Channel channel, Member target, Object data) throws Exception {
		System.out.println("S:" + new String((byte[])data));

	}

	@Override
	public void dataNotSent(Channel channel, Member target, Object data) throws Exception {
		System.out.println("E:" + new String((byte[])data));
	}
	
	@Override
	public void exceptionCaught(Channel channel, Member source, Throwable cause) {
		cause.printStackTrace();
	}

}
